<?

function toArray( $data )
{
  if ( is_object( $data ) )
  {
    $data = get_object_vars( $data );
  }
  return is_array($data) ? array_map(__FUNCTION__, $data) : $data;
}

$c = $_GET['code'];

$acc = file_get_contents("https://graph.facebook.com/oauth/access_token?client_id=224416074306696&redirect_uri=http://www.thehi.me/pennapps/david.php&client_secret=aa381593c5dce50d356c5bd8b653c069&code=$c");

echo $acc;

$temp = explode("&", $acc);
$temp = explode("=", $temp[0]);

$likes = file_get_contents("https://graph.facebook.com/me/likes?access_token=AAADMGvBkFIgBAIeg0SsH1NyWLWzoBOZBBlKikbTfbZAxzK9vDgXeuLG7miS6tzMdXQQvkzJ3JZA7RAQiiySou6CHoqpERm5EjZByjJu1YHN885o0wIoQ");

$likes = json_decode(toArray($likes));

echo "<br /><br /><br />$likes";